//
//  NSMutableDictionary+Safe.m
//  mmbang
//
//  Created by 倪元政 on 16/7/7.
//  Copyright © 2016年 iyaya. All rights reserved.
//

#import "NSMutableDictionary+Safe.h"

@implementation NSMutableDictionary (Safe)

- (BOOL)safeSetObject:(id)anObject forKey:(id)key {
    if (anObject && key && [key conformsToProtocol:@protocol(NSCopying)]) {
        [self setObject:anObject forKey:key];
        return YES;
    } else {
        return NO;
    }
}

- (BOOL)safeRemoveObjectForKey:(id)aKey {
    if (aKey) {
        [self removeObjectForKey:aKey];
        return YES;
    } else {
        return NO;
    }
}


@end
